/**
 * Author: runlin tang
 * Creation Time: 2016/9/2.
 * Description:...
 */
define(['jquery','artTemplate','../m/netIpPostM', '../../../common/js/lib/text!../../../tpl/footer.tpl'],
    function ($,artTemplate,netIpPostM,footerT) {
        function netIpV(datas) {
            var lanip = (datas.data.lanip != null ) ? datas.data.lanip : '';
            var lannetmask = (datas.data.lannetmask != null ) ? datas.data.lannetmask : '';
            var html = '';
            html+='<div class="header"><a href="/h5-wizard/index.html#system-state" class="back-a"></a><p>局域网设置</p><a class="header-right">保存</a></div>';
            html+='<div class="content">';
            html+='<div class="success-txt m-t-6 relative-bottom right-input"><i>IP地址</i><input type="text" class="lanip" value="'+lanip+'"><p>默认：10.0.0.10</p></div>';
            html+='<div class="success-txt m-t-6 relative-bottom right-input"><i>子网掩码</i><input type="text" class="lannetmask" value="'+lannetmask+'"><p>默认：255.255.255.0</p></div>';
            html+='</div>';

            var footer = artTemplate.compile(footerT);
            html += footer({type:4});
            $(".webApp-content").html(html);


            $(".header-right").on('click',function(){

                var lannetmask = $(".lannetmask").val();
                var lanip = $(".lanip").val();
                var data = JSON.stringify({
                    "lanip": lanip,
                    "lannetmask": lannetmask,
                })
                netIpPostM(data);
            });

        }

        return netIpV;
    });